# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Ronald van Haren <ronald.archlinux.org>

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - remove makedepend on vc

pkgname=calligra
pkgdesc='A set of applications for productivity and creative usage'
pkgver=4.0.0
pkgrel=2
arch=(x86_64)
url='https://www.calligra-suite.org/'
license=(GPL-2.0-only)
depends=(cauchy
         fontconfig
         freetype2
         gcc-libs
         glibc
         gsl
         imath
         karchive
         kcolorscheme
         kcompletion
         kconfigwidgets
         kcoreaddons
         kdbusaddons
         kdiagram
         kcmutils
         kconfig
         kcrash
         kguiaddons
         ki18n
         kiconthemes
         kio
         kitemviews
         knotifications
         knotifyconfig
         kservice
         ktextwidgets
         kwidgetsaddons
         kwindowsystem
         kxmlgui
         libodfgen
         librevenge
         openssl
         phonon-qt6
         qt6-base
         qt6-declarative
         qt6-svg
         qtkeychain-qt6
         sonnet
         zlib)
makedepends=(boost
             eigen
             extra-cmake-modules
             kdoctools
             libetonyek
             libvisio
             libwpg
             libwps
             okular
             pstoedit
             qt6-webengine)
optdepends=('libetonyek: Apple Keynote import filter'
            'libvisio: Microsoft Visio import filter'
            'libwpg: Corel WordPerfect Graphics image importer'
            'libwps: Microsoft Works file word processor format import'
            'poppler: PDF to SVG filter'
            'pstoedit: EPS to SVG filter'
            'qt6-webengine: Braindump web shape')
source=(https://download.kde.org/stable/$pkgname/$pkgname-$pkgver.tar.xz{,.sig}
        dependencies.patch
        docs.patch)
sha256sums=('e97cb1dc0720074d37d8ec11662f2628384595311c3dac6b29477d6634144119'
            'SKIP'
            'b14146c4e9574aed8d0266d6cb943b82c69fe252409b7e9d96c2e585333ecd03'
            'e6c504adbe884be190c3016f75ec3897c7364d7ca82a695614b34a2a56288d90')
validpgpkeys=(39FFA93CAE9C6AFC212AD00202325448204E452A) # Carl Schwan <carl@carlschwan.eu>

prepare() {
  patch -d $pkgname-$pkgver -p1 < dependencies.patch
  patch -d $pkgname-$pkgver -p1 < docs.patch
}

build() {
  cmake -B build -S $pkgname-$pkgver \
    -DRELEASE_BUILD=ON \
    -DPRODUCTSET=DESKTOP \
    -DBUILD_TESTING=OFF
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build
}
